import { getAction, postAction, putAction, deleteAction } from '@/api/manage'

// 供应商基本信息管理
const supplierList = (params) => getAction('/wms/supplier/list', params)
const supplierDetail = (id) => getAction('/wms/supplier/queryById', { id })
const supplierAdd = (params) => postAction('/wms/supplier/add', params)
const supplierEdit = (params) => putAction('/wms/supplier/edit', params)
const supplierDelete = (id) => deleteAction('/wms/supplier/delete', { id })
const supplierBatchDelete = (ids) => deleteAction('/wms/supplier/deleteBatch', { ids })
const supplierExport = (params) => getAction('/wms/supplier/exportXls', params)
const supplierImport = (params) => postAction('/wms/supplier/importExcel', params)
const supplierPurchaseHistory = (params) => getAction('/wms/supplier/purchase/history', params)

// 供应商联系人管理
const contactList = (params) => getAction('/wms/supplier/contact/list', params)
const contactListBySupplier = (supplierId) => getAction('/wms/supplier/contact/listBySupplier', { supplierId })
const contactAdd = (params) => postAction('/wms/supplier/contact/add', params)
const contactEdit = (params) => putAction('/wms/supplier/contact/edit', params)
const contactDelete = (id) => deleteAction('/wms/supplier/contact/delete', { id })
const contactBatchDelete = (ids) => deleteAction('/wms/supplier/contact/deleteBatch', { ids })

// 供应商物料关联管理
const materialList = (params) => getAction('/wms/supplier/material/list', params)
const materialListBySupplier = (supplierId) => getAction('/wms/supplier/material/listBySupplier', { supplierId })
const materialAdd = (params) => postAction('/wms/supplier/material/add', params)
const materialEdit = (params) => putAction('/wms/supplier/material/edit', params)
const materialDelete = (id) => deleteAction('/wms/supplier/material/delete', { id })
const materialBatchDelete = (ids) => deleteAction('/wms/supplier/material/deleteBatch', { ids })
const materialSuppliers = (materialCode) => getAction('/wms/supplier/material/suppliers', { materialCode })

export {
  // 供应商基本信息管理
  supplierList,
  supplierDetail,
  supplierAdd,
  supplierEdit,
  supplierDelete,
  supplierBatchDelete,
  supplierExport,
  supplierImport,
  supplierPurchaseHistory,
  
  // 供应商联系人管理
  contactList,
  contactListBySupplier,
  contactAdd,
  contactEdit,
  contactDelete,
  contactBatchDelete,
  
  // 供应商物料关联管理
  materialList,
  materialListBySupplier,
  materialAdd,
  materialEdit,
  materialDelete,
  materialBatchDelete,
  materialSuppliers
} 